package org.springblade.modules.repair.vo;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.Data;
import org.springblade.core.tool.node.INode;

import java.util.ArrayList;
import java.util.List;

/**
 * @Author ysq
 * @Date 2025/07/15
 * @Description
 */
@Data
public class BuildingElevatorTemplateReleTreeVO implements INode<BuildingElevatorTemplateReleTreeVO> {

	/**
	 * 主键ID
	 */
	@JsonSerialize(using = ToStringSerializer.class)
	private Long id;

	/**
	 * 模板层级号
	 */
	private String templateNum;

	/**
	 * 模板层级名称
	 */
	private String templateName;

	/**
	 * 模板id
	 */
	private Long templateId;

	/**
	 * 父级id
	 */
	private Long parentId;

	/**
	 * 子孙节点
	 */
	@JsonInclude(JsonInclude.Include.NON_EMPTY)
	private List<BuildingElevatorTemplateReleTreeVO> children;

	/**
	 * 是否有子孙节点
	 */
	@JsonInclude(JsonInclude.Include.NON_EMPTY)
	private Boolean hasChildren;

	@Override
	public List<BuildingElevatorTemplateReleTreeVO> getChildren() {
		if (this.children == null) {
			this.children = new ArrayList<>();
		}
		return this.children;
	}

	public Boolean getHasChildren() {
		return this.children.size() > 0;
	}
}
